1. Field of the Invention
The present invention relates to a method and system for deleting invalid pixels in a 3D computer graphic processing, especially relates to a method and system for deleting invalid pixels in a 3D computer graphic processing by comparing the depth values of the pixels stored in cache memories which satisfy a Z Test Mode with the depth values of input pixels being processed.
2. Description of the Related Art
Referring to FIG. 1, the Z-buffer pre-test system for 3D graphic performance enhancement disclosed in U.S. Ser. No. 09/360,597, which was filed by the applicant, comprises a FIFO 7, a pre-test Z cache 11, a Pre-test Z module 8, a validity-test module 9, a Z-buffer cache 14, a Z-buffer test module 10, a frame buffer memory 13 and a control logic 6. The FIFO 7 is used to store the input pixels being processed. The pre-test Z cache 11 is used to store the depth values of all pixels having been inputted according to a Z Test Mode. The pre-test Z module 8 is used to compare the depth values of input pixels being processed with the depth values stored in the pre-test Z cache 11 according to the Z Test Mode. If the answer is yes, the content of the pre-test Z cache is updated. If the answer is no, the input pixels are discarded. The validity-test module 9 is used to process a series of tests, such as a scissor test for determining if an input pixel being processed is inside or outside a view port on the screen, such as an alpha test for comparing the alpha value of an input pixel being processed with the predefined alpha value of the system to determine if the input pixel should be discarded, such as a stencil test for comparing a reference value of an input pixel being processed with a parameter stored in a stencil buffer modified by instructions to determine if the input pixel being processed should be discarded. The Z-buffer cache 14 is used to store the depth values of all pixels having been inputted according to the Z Test Mode. The Z-buffer test module 10 is used to compare the depth values of input pixels being processed with the content of the Z-buffer cache 14 according to the Z Test Mode. If the answer is yes, the Z-buffer cache 14 is updated. If the answer is no, the input pixel being processed is discarded. The frame buffer memory 13 is used to store all pixels having passed validity tests. The validity tests include all functions of a depth test, scissor test, alpha test and stencil test mentioned above. The control logic 6 can further comprise a state machine 12 for managing the operations of all components simultaneously.
The original application can be further improved to meet all needs of a 3D computer graphic system. For example, there is a shading process for generating smooth colors in a 3D image processing. The shading process will generate a plurality of parallel input pixels simultaneously. Under the circumstance, the original application will slow down the executing speed if using a sequential process for the plurality of parallel input pixels.